//===============================================================================
// Microsoft Architecture Strategy Team
// LitwareHR - SaaS Sample Application
//===============================================================================
// Copyright  Microsoft Corporation.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
//===============================================================================


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LitwareHR.Portfolio.Gateways;
using LitwareHR.Recruiting.Contract;

namespace LitwareHR.PublicApp.Presenters.Careers.Evaluation
{
    public class ResumeDetailsPresenter
    {
        IResumeDetailsView _view;

        public ResumeDetailsPresenter(IResumeDetailsView view)
        {
            _view = view;
        }

        public void OnViewLoaded(Guid resumeId, string positionName)
        {
            Resume resume = RecruitingGateway.GetResume(resumeId);
            _view.ShowResumeDetails(resume, positionName);

            SilverlightAccount silverligthAccount = RecruitingGateway.GetSilverlightAccount();
            if (silverligthAccount != null)
            {
                if (!string.IsNullOrEmpty(silverligthAccount.AccountId))
                {
                    VideoUploadState uploadState = resume.VideoUploadState;
                    string silverLightAppName = string.Empty;
                    if (uploadState == VideoUploadState.Available)
                    {
                        silverLightAppName = resumeId.ToString().Replace("-", String.Empty);
                    }
                    _view.ShowSilverlightVideo(silverLightAppName, silverligthAccount.AccountId, uploadState);
                }
            }
        }
    }
}
